/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.fresh.bus.canoe.server.support;

import com.fresh.bus.canoe.message.MessageCodec;
import com.fresh.bus.canoe.message.ResponseQueue;
import com.fresh.bus.canoe.server.CanoeServer;
import com.fresh.bus.canoe.server.LifecycleHandler;

/**
 *
 * @author panzd
 */
public abstract class AbstractCanoeServer implements CanoeServer {
    private LifecycleHandler lifecycleHandler = new DefaultLifecycleHandler();
    private MessageCodec messageCodec;
    private ResponseQueue responseQueue;
    /**
     * @return the messageCodec
     */
    public MessageCodec getMessageCodec() {
        return messageCodec;
    }

    /**
     * @param messageCodec the messageCodec to set
     */
    public void setMessageCodec(MessageCodec messageCodec) {
        this.messageCodec = messageCodec;
    }

    /**
     * @return the responseQueue
     */
    public ResponseQueue getResponseQueue() {
        return responseQueue;
    }

    /**
     * @param responseQueue the responseQueue to set
     */
    @Override
    public void setResponseQueue(ResponseQueue responseQueue) {
        this.responseQueue = responseQueue;
    }

    /**
     * @return the lifecycleHandler
     */
    public LifecycleHandler getLifecycleHandler() {
        return lifecycleHandler;
    }

    /**
     * @param lifecycleHandler the lifecycleHandler to set
     */
    public void setLifecycleHandler(LifecycleHandler lifecycleHandler) {
        this.lifecycleHandler = lifecycleHandler;
    }

    @Override
    public void start()
    {
        if(responseQueue != null)
        {
            responseQueue.start();
        }
    }
}
